package com.Atao.mapper;



import com.Atao.pojo.AiMessage;
import com.Atao.pojo.AiPhotos;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AiMapper {
    //插入会话记录
    @Insert("insert into messages(user_id,user_message,ai_message)"
            + "values(#{userId},#{userMessage},#{aiMessage})")
    void add(AiMessage aiMessage);

    //查询会话列表
    @Select("select * from messages where user_id =#{userId}")
    List<AiMessage> list(Integer userId);


    //插入图片会话记录
    @Insert("insert into photos(user_id,user_message,url)"
            + "values(#{userId},#{userMessage},#{url})")
    void addPhoto(AiPhotos aiPhotos);

    //查询图片会话列表
    @Select("select * from photos where user_id =#{userId}")
    List<AiPhotos> photoList(Integer userId);

    //删除文字会话记录
    @Delete("delete from messages where user_id =#{userId}")
    void deleteMessages(Integer userId);

    //删除图片会话记录
    @Delete("delete from photos where user_id =#{userId}")
    void deletePhotos(Integer userId);
}
